home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / util / shell / axsh_1_3_demo.lha / InstallDisk.lha / man / axsh.man < prev    next >
Text File  |  1993-02-18  |  16KB  |  493 lines

  1. Monday 21-Sep-92 15:20:38
  2.  
  3. AXSH(1)                   USER COMMANDS            Version 1.26
  4.  
  5.  
  6. NAME
  7.     AXsh - a shell (command interpreter)
  8.  
  9. SYNOPSIS
  10.     AXsh
  11.  
  12. DESCRIPTION
  13.     AXsh, the AXshell, is a command  interpreter with a number of
  14.     convenient  features for interactive use that  are or are not
  15.     available with the standard AmigaDOS shell, including command
  16.     aliasing,history events, variables, filename and command name
  17.     completion , shell level protections and a number of built-in
  18.     commands.
  19.  
  20. OPTIONS
  21.     -con    Turn off carrier checking (console mode)
  22.  
  23.     -log    Keep log (AXsh:etc/adm/log.*)
  24.  
  25.     -user <user>
  26.         Accepts user without asking the password. Account for
  27.         the  user  must still exist in /etc/passwd.  In  this
  28.         mode  "login"  command  causes  relogin with the same
  29.         login  name.  This  option is useful with closed UUCP
  30.         systems.
  31.  
  32.  
  33. Command Line Editing
  34.     The command line editor has two modes depending on the 'term'
  35.     environmental variable (vt100 or ANSI). In ANSI-mode it sends
  36.     more bytes, so vt100-mode is recommended.
  37.  
  38.     The editor knows about these commands:
  39.  
  40.     left/right ^B/^F    Moves cursor left and right
  41.     up/down    ^P/^N    Recalls history events
  42.     Shift-left    ^A    Goto the start of line
  43.     Shift-right   ^E    Goto the end of line
  44.     Shift-up        Try history completion
  45.     Backspace        Delete previous character
  46.     Delete       (^D)    Delete current (next) character
  47.     ^L, ^R            Refresh line
  48.     ^K            Delete to the end of line
  49.     ^U            Delete to the start of line
  50.     ^W            Delete previous word
  51.     ^X            Delete line
  52.  
  53.     TAB (^I)        Try command/filename completion
  54.     Return/Newline (^J/^M)    End editing :-)
  55.  
  56.     HELP            String assigned in variable HELP
  57.     F1            String in variable F1
  58.      :             :
  59.      :             :
  60.     F20            String in variable F20
  61.  
  62. Command Line Parsing
  63.     A  simple  command  is  composed of a sequence of words.  The
  64.     first word specifies the command to be executed. One line can
  65.     have several commands separated with a semicolon (";").
  66.  
  67. Variable substitution
  68.     In case '$' is encountered, it is treated as an environmental
  69.     variable  and  the  variable is replaced by its value. If the
  70.     variable  is  to  be part of a word, it must be surrounded by
  71.     braces of some kind.  The substitution is not done inside the
  72.     quotes .  List  of  the reserved and special variables may be
  73.     found elsewhere in this document.
  74.  
  75.     $name        Normal type, will (usually) select the whole
  76.             variable as is.
  77.     $name[select]    Selects only one word from the variable.
  78.             Numbering starts from zero. If the referenced
  79.             word doesn't exist,a NULL string is returned.
  80.     ${name}[select]    When the variable name contains spaces or '['
  81.             chars , it must be surrounded by braces.  Any
  82.             pair of "()", "[]" and "{}" are considered as
  83.             braces.
  84.     examples:
  85.  
  86.     > echo $user
  87.     root
  88.     > echo ${tty}/$[host] $(quota)kB
  89.     con7/amiga.pasbox.fi 30kB
  90.  
  91.     > echo ${s p a c e}
  92.  
  93.     You can still use $-sign by doubling it ($$->$).  Another way
  94.     to use $-sign is to preceed it with a back-slash (\).
  95.  
  96.     There is a special variable: $< , which reads a line from the
  97.     standard  input and that line is appended to the command line
  98.     as is.
  99.  
  100.     Each variable is inserted as a single argument, even if it
  101.     consists of several words. If you want to add something to the
  102.     same argument, you can use e.g.
  103.  
  104.         $[var1]" text "$var2    "a"\"$[var]\""b"
  105.  
  106. Command Separator
  107.     If  you  want  to execute several commands from a single line
  108.     you  can use ';' as a delimiter. This command separator works
  109.     only with command line, not from scripts.
  110.  
  111.     In script files semicolon is used as a comment-mark!
  112.  
  113.     e.g. "cd arc: ; ls"
  114.  
  115.     If  you  want  to use semicolon on its own, preceed it with a
  116.     backslash: "\;". The same applies to every special character.
  117.  
  118.     e.g. "echo ls \; more file\ name ; ls ; more file\ name"
  119.  
  120. History Events
  121.     History events allows you to call for already typed lines for
  122.     editing.  You  can use either cursor keys up/down or type the
  123.     !-character  and  the  command number. History numbers can be
  124.     found  out  with  the 'history'-command,which is built in the
  125.     getline-routine.  The  number  of  history-lines is fixed and
  126.     cannot be set by user.
  127.  
  128. Command, history, directory and filename completion
  129.     The  command line editor offers you the ability to complete a
  130.     partial  filename  by  pressing TAB (^I). If the name matches
  131.     several  files  or directories, expansion is made only to the
  132.     extent it can be made and a BELL (^G) is printed.
  133.  
  134.     If you apply TAB (^I) to the first word on a line,the word is
  135.     treated  as a command and the completion is made accordingly.
  136.     If no perfect match was found on the command set , a filename
  137.     completion is tried. Remember that these actions are separate,
  138.     and  a  partial  completion  may  be  performed  in the ccomp
  139.     routine  before  passing  the partial filename to fcomp.  You
  140.     can do completions on redirections too.
  141.  
  142.     History  completions are also possible.  This function can be
  143.     invoked using shift+crsr up.  It behaves like fcomp and beeps
  144.     for a partial completion.
  145.  
  146. Aliases
  147.     The AX shell maintains a list of aliases that you can create,
  148.     display  and modify using the alias and unalias commands. The
  149.     shell  checks the beginning of each command line to see if it
  150.     matches a name of an existing alias.  If it does, the command
  151.     is reprocessed with the alias definition replacing its name.
  152.  
  153.     Aliases  shouldn't be nested .  An alias definition shouldn't
  154.     contain another alias as the first command, because the alias
  155.     substitution is made only once for each command. So,recursive
  156.     aliases  are  not  possible , but looping aliases are easy to
  157.     create. To break such loop, you may have to send successive
  158.     BREAKs (^C) for undefined period of time (depending on the
  159.     command inside the loop).
  160.         (ex. alias loop wait 10\;loop)
  161.  
  162.     You cannot make an alias for strings 'alias' or 'unalias', so
  163.     these commands are always accessible.
  164.  
  165.     Aliases  are  case-sensitive,  so  you can escape an alias by
  166.     typing the command using a different case.
  167.  
  168. I/O Redirection
  169.     The  following metachars indicate that the subsequent word is
  170.     the name  of a file to which the command's standard output is
  171.     redirected. Standard input cannot yet be redirected.
  172.     Redirection does not work with all of the shell builtins.
  173.  
  174.     >    Redirect  the standard output to a file . If the file
  175.         does not exist, it is created. If it does exist,it is
  176.         overwritten; its previous contents are lost.
  177.  
  178.     >>    Append the standard output. Like >, but places output
  179.         at the end of the file rather than overwriting it. If
  180.         the file does not to exist, it is created.
  181.  
  182.     |    Simple piping. Everything after the pipe symbol in the
  183.         command line is considered to be another command. The
  184.         piping uses temporary files created in T:.
  185.  
  186.     Redirection and piping can't be used simultaneously !
  187.  
  188. Command Execution
  189.     If  the  command is a AXshell built-in, the shell executes it
  190.     directly.   Otherwise,  the shell searches for a file by that
  191.     name with execute permission.  If the command-name contains a
  192.     /  or  a  :  the shell takes it as a pathname, but completely
  193.     ignores it. This way unsecure commands won't be executed. You
  194.     can also use this feature to supress alias-replacement.
  195.  
  196.     e.g. c:dir would use the command 'dir', not the alias for dir
  197.  
  198.     For superusers in local (console) mode things are not as
  199.     simple. Paths are used as is.
  200.  
  201. Signal Handling
  202.     The  AXshell normally ignores all signals.  Ctrl-D is checked
  203.     only if the ignoreeof-variable it SET. Ctrl-C it not yet used
  204.     for anything .  It is upto the running program to acknowledge
  205.     break signals.  AXsh will exit if it detects an EOF situation
  206.     or a loss of carrier.  If  you  open  AXsh in a window with a
  207.     close-gadget, it can also be used to make AXsh exit.
  208.  
  209. Directory and filename expansion
  210.     The  shell expands all arguments containing ':' or '/' chars.
  211.     This  way  all external commands get the right parameters and
  212.     you  still  have  a consistent referencing in filesystem: you
  213.     can use '~/' to refer to home dir in any command.
  214.  
  215.     This expansion can be turned off by defining the 'f'-flag for
  216.     the command in AXsh:etc/rc.  This  means that the argument is
  217.     not a filename.
  218.  
  219.     Wildcard expansion isn't made by AXsh,but the command itself,
  220.     if it supports wildcards. This may change in the future.
  221.  
  222. Built-In Commands
  223.     Built-in commands are executed within the AXshell.
  224.  
  225.     ;    Null command.This command is interpreted,but performs
  226.         no action.  Actually this contains two null-commands.
  227.         In script files semicolon is used as a comment mark.
  228.  
  229.     alias [ name [ def ] ]
  230.         Assign "def" to the alias name. "name" is not allowed
  231.         to be "alias" or "unalias" .  If def is omitted , the
  232.         alias  name  is  displayed  along  with  its  current
  233.         definition. If both the name and def are omitted, all
  234.         aliases are displayed. The name is the first argument
  235.         and the definition is the second.
  236.  
  237.         e.g. alias help "man axsh"
  238.  
  239.         You can remove all aliases with "alias clear".
  240.  
  241.     cd [ dir ]
  242.         Change  the  shell's  working  directory to directory
  243.         dir.   If  no  argument  is given, change to the home
  244.         directory of the user. ~ denotes home directory and :
  245.         denotes  the  root  directory  of the current working
  246.         directory.  '..' is the parent directory and / is the
  247.         AXsh: assign or disk.
  248.  
  249.         "cd" may be omitted ,  if there is no command mathing
  250.         the directory name.
  251.  
  252.     echo    Just prints out everything to the output. Mainly used
  253.         on  script files for output.  The trailing newline is
  254.         not printed if the first argument is "-n" or the last
  255.         argument is "noline".
  256.  
  257.         Example: echo $realname has logged on $host
  258.  
  259.     execute script-file
  260.         Get the commands from a specified file. The execution
  261.         continues  until  the end of file is reached or if an
  262.         error occurs. Empty lines are skipped. Scripts can be
  263.         nested, but the recursion depth is limited.
  264.  
  265.         Since 1.3 you can also redirect the output of a script.
  266.  
  267.         "execute" may be omitted, if there is no command with
  268.         the same name as the script-file nor a directory with
  269.         the same name (currently this is impossible in Amiga).
  270.         "execute" still appears as the zeroth argument to the
  271.         script.  The  script file bit must also be set if you
  272.         plan to start the script with only its name !
  273.  
  274.     exit    The shell exits and hangs up, if remote connection.
  275.  
  276.     ftp file [file2 ..]
  277.         Will copy the file(s) to the home directory.
  278.  
  279.     internal
  280.         Lists all internal commands. It is still possible that
  281.         they aren't allowed to all users, depending on /etc/rc.
  282.  
  283.     login    Terminate a login and initiate a new one.
  284.  
  285.     protect modes file [file2 ..]
  286.         Parses the mode argument and then sets the protection
  287.         bits accordingly. You can set, clear and toggle ANY
  288.         defined bit, including group and world protection
  289.         bits.
  290.  
  291.         e.g.    protect go+r-w /etc/systemaliases
  292.  
  293.         However, THESE BITS ARE NOT USED in AXsh yet, but ls
  294.         shows them.
  295.  
  296.     quit    A null-command. Otherwise used to exit scripts.
  297.  
  298.     quota    Shows  home  filesystem , number of files used , disk
  299.         space used and usage limit. Will return warning level
  300.         (5) if the quota is exceeded.
  301.  
  302.     set [ var [ definition ] ]
  303.         Create or modify a shell variable.  There are several
  304.         predefined ones that cannot be changed and some, with
  305.         whom the changes are discarded. Actually all variables
  306.         are  currently  environmental  variables, but this is
  307.         supposed to change.
  308.  
  309.         The variable name is the first argument and the
  310.         definition is the second.
  311.  
  312.         From version 1.3 all AXsh variables are exported to 2.0
  313.         shell local variables. You also have a list of WORM-
  314.         variables that can only be set once (/etc/ForbiddenVars).
  315.  
  316.         e.g. set HELP "cat /etc/motd\n"
  317.  
  318.         -- System variables:
  319.  
  320.         user        user's login name
  321.         tty        which terminal 'line' the user uses
  322.         accesslevel    just what it says.
  323.         realname    full name of the user
  324.         home        user's home directory
  325.         host        current host name
  326.         dosv        system version
  327.         intime        time the user has been logged in (mins)
  328.  
  329.         -- Special variables:
  330.         autologout    in minutes - time between keystrokes
  331.                 in AXsh for automatic logout.
  332.  
  333.         language    What catalog to use. If the language
  334.                 is not found or the variable is not
  335.                 set, English is used.
  336.  
  337.                 Currently you can select one of these:
  338.                  suomi        (Finnish)
  339.                  français    (French)
  340.                  dansk        (Danish)
  341.                  español    (Spanish)
  342.                  svenska    (Swedish)
  343.                 Or use the default English.
  344.  
  345.         cwd     current working directory
  346.         quota     disk space currently used (in kB)
  347.  
  348.         lasterr     return code from the last command
  349.         ioerr     IoErr() returned by the last external command
  350.              Lasterr and ioerr are not seen in the variable list.
  351.  
  352.         term     terminal emulation (vt100 or ansi, def:ansi)
  353.         rows     number of rows on terminal (default: 24)
  354.         visual     name of the full screen editor (def: editor)
  355.         edscroll scroll length in lines (in editor)
  356.         prompt     the prompt format:
  357.              Variables:
  358.                %%    % itself
  359.                %d    current working directory
  360.                %h    command counter
  361.                %l    line (terminal)
  362.                %M    hostname
  363.                %q    actual quota/limit
  364.                %r    full name
  365.                %t    time (full time now, might change)
  366.                %u    username
  367.                %i    intime (in minutes)
  368.  
  369.              C-style special codes:
  370.                \e    ESC
  371.                \t    TAB
  372.                \n    Newline
  373.                \r    CR
  374.                \a    BEL
  375.  
  376.              Control codes:
  377.                ^L    Ctrl-l
  378.                ^G    Ctrl-g
  379.                etc..
  380.  
  381.              any other character as is, default prompt
  382.              is "%h.%d> "
  383.              Example:
  384.                set prompt "\\e[1m(%u)\\e[m %%%h \\e[7m%d\\e[m > "
  385.  
  386.              Notice that you have to double the backslashes,
  387.              because they have precedence over doublequotes.
  388.  
  389.         ignoreeof
  390.              if this variable is set, ^D will do exit..
  391.              It is actually reversed from the tcsh.
  392.  
  393.         HELP     You can create macros by defining these
  394.         F1     variables. e.g.
  395.         ..        set F1 "^a^d^d^d^drm^e"
  396.         F20     will goto start of line, delete 4 chars, add
  397.              "rm" and goto end of line when you press F1.
  398.              C-style codes and control characters are like in
  399.              the prompt.
  400.  
  401.         -- Special variables in scripts --
  402.  
  403.         argument Works only with a word specifier, not as $argument.
  404.              argument[0] is 'execute', argument[1] is the
  405.              script name (possibly including path) etc.
  406.              This variable is not seen in the variable list.
  407.  
  408.     sysinfo    Print out some information about the OS version etc.
  409.  
  410.     unalias word [word2 .. [wordn]]
  411.         Discard one or more aliases.
  412.  
  413.     unset var [var2 .. [varn] ]
  414.         Discard one or more shell variables.
  415.  
  416.     upload file [file2 ..]
  417.         Copies the file(s) to the system upload directory.
  418.  
  419.     uptime    Displays uptime and system load information.
  420.  
  421.     wait time
  422.         Goto sleep for time (in seconds). Wait can be stopped
  423.         with a keypress.
  424.  
  425.     which command
  426.         Will show from where the command is executed. e.g.
  427.  
  428.         %14 (root) AXsh:home/root/ 169 > which dir
  429.         AXsh ALIAS
  430.         DH0:Oldsys/C/Dir
  431.         c:dir
  432.  
  433.         Dir is an alias, but otherwise DH0:oldsys/c/dir would
  434.         have been executed. There is also another dir in the
  435.         command search path, c:dir.
  436.  
  437.     who    Displays uptime and load information with a list of the
  438.         users currently logged in.
  439.  
  440.     whoami    Print out your current login name
  441.  
  442.     write user text [text ..]
  443.         Will send the text to another user in the system.
  444.         If the user is not logged in, an error message is
  445.         displayed instead.
  446.  
  447. Special script file commands
  448.  
  449.     The if-construct is a bit lame, but there simply are some
  450.     more important features to think about..
  451.  
  452.     if    Keywords for if-else-endif -contruct.
  453.     else    The condition can be one of the forms :
  454.     endif        "foo" == "foo"
  455.             "bar" != "foobar"
  456.             exists file
  457.  
  458.         If you use variable, the form depends on the variable
  459.            $var != "foo" will become:
  460.            "" != "foo"    , if the variable is empty and
  461.            var != "foo"    , if the variable is unset
  462.  
  463.     goto label
  464.         Jumps to a defined label. It is an error if the label
  465.         doesn't exist.
  466.  
  467.     quit    Exits the script
  468.  
  469.     label: [command]
  470.         Command  labeling .  The command is optional, and the
  471.         label is ignored in the command execution. A label
  472.         name cannot have spaces in it.
  473.  
  474.     ; comment
  475.         Commenting. Starts a comment which proceeds to the
  476.         next end-of-line.
  477.  
  478. FILES
  479.     /bin/AXsh        AXsh executable
  480.     /etc/rc            Configuration file
  481.     /etc/ForbiddenVars    File holding all untouchable variables:
  482.                    <varname> [<number of sets allowed>]
  483.     /etc/GlobalLogin    Script executed at login, can be used to
  484.                 set system variables like POSTNEWS etc.
  485.                 Still executed with user's privileges.
  486.     ~/.lastlogin        Showed by the login shell at login.
  487.     ~/.logout        Script which is EXECUTEd at logout
  488.     ~/.login        Script which is EXECUTEd at login
  489.  
  490. SEE ALSO
  491.     login, exit, cd, execute
  492.  
  493.